#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	long long n;
	int sum = 0;
	scanf("%I64d",&n);
	while(n)
	{
		long long x;
		x = n%10;
		if(x==4||x==7)
		{
			sum++;
		}
		n = n/10;
	}
	if(sum==4||sum==7)
		printf("YES\n");
	else printf("NO\n");
	return 0;
}
